import QtQuick 2.15

Item {
    id: delegate
    width: 250
    height: 250
    HomeDetailDialog {
        id: homeDetailDialog
    }

    Rectangle {
        id: rectangle
        color: "#bdbdbd"
        anchors.fill: parent
        anchors.margins: 12
        visible: true
        radius: 4
    }

    Text {
        id: timeText
        x: -8
        anchors.left: parent.Left
        anchors.top: cardNo.bottom
        width: parent.width
        anchors.margins: 12
        height: 34
        horizontalAlignment: Text.AlignHCenter
        anchors.topMargin: 34
        text: totalTimes
        font.pixelSize: 26
    }


    Text {
        id: totalAmountText
        x: 0
        anchors.left: parent.Left
        anchors.top: timeText.bottom
        width: parent.width
        anchors.margins: 12
        height: 34
        horizontalAlignment: Text.AlignHCenter
        anchors.topMargin: 54
        text: totalAmount
        font.pixelSize: 26
    }

    Text {
        id: cardNo
        anchors.left: parent.Left
        anchors.top: parent.top
        width: parent.width
        anchors.margins: 12
        height: 40
        text: cardNoText
        font.pixelSize: 26
        horizontalAlignment: Text.AlignHCenter
        rotation: 0.535
    }


    MouseArea {
        anchors.fill: parent
        hoverEnabled: true
        onClicked: delegate.GridView.view.currentIndex = index
    }

    states: [
        State {
            name: "Highlighted"

            when: delegate.GridView.isCurrentItem

            PropertyChanges {
                target: rectangle
                visible: false
            }
        }
    ]
}
